package com.atguigu.day21.test04;

import java.io.*;
import java.nio.charset.StandardCharsets;

/**
 * @author fenge
 */
public class Test04 {
    public static void main(String[] args) throws IOException {
        InputStreamReader isr = new InputStreamReader(new FileInputStream("D:\\atguigu\\Day18-Map和File\\homework\\我想对你说.txt"),"GBK");
        OutputStreamWriter osw = new OutputStreamWriter(new FileOutputStream("我想对你说.txt"), StandardCharsets.UTF_8);
        char[] b = new char[2];
        int len ;
        while ((len= isr.read(b))!=-1){
            osw.write(b,0,len);

        }
       /* char[] cs = new char[2];
        while (true){
            int len = isr.read(cs);
            if (len==-1){
                break;
            }
            osw.write(cs,0,len);
        }*/


/*       byte[] bytes = new byte[1024];
        int len;
        if ((len=isr.read(bytes))!=-1){
            bos.write(bytes,0,len);
        }*/
        osw.close();
        isr.close();
    }
}
